#!/usr/bin/python3
# -*- coding:utf-8 -*-
"""
@author: henry_oulen@163.com
@file: log.py
@time: 2023/10/27 19:47
@desc: 
"""

from backend.conf import config
from backend.tvadmin.utils.mysql_base import SqlAlBase, MysqlBase
from sqlalchemy import Column, Integer, String, DateTime, Boolean, Float, Text

from backend.tvadmin.utils.model_utils import ModelBase

class OperationLog(ModelBase, SqlAlBase.base):
    """
    操作日志
    """
    __tablename__ = config.table_prefix + 'system_operation_log'
    request_modular = Column(String(64), nullable=True, unique=False, comment="模块")
    request_path = Column(String(64), nullable=True, unique=False, comment="路径")
    request_body = Column(Text, nullable=True, unique=False, comment="请求体")
    request_method = Column(String(64), nullable=True, unique=False, comment="方法")
    request_msg = Column(String(64), nullable=True, unique=False, comment="操作说明")
    request_ip = Column(String(64), nullable=True, unique=False, comment="请求ip地址")
    request_browser = Column(String(64), nullable=True, unique=False, comment="浏览器")
    response_code = Column(String(64), nullable=True, unique=False, comment="响应状态码")
    request_os = Column(String(64), nullable=True, unique=False, comment="操作系统")
    json_result = Column(Text, nullable=True, unique=False, comment="返回信息")
    status = Column(String(64), nullable=True, unique=False, comment="响应状态")

    def __repr__(self):
        return self.id

if __name__ == '__main__':
    # 执行此代码，就会把创建好的 Module 映射到数据库中
    # Base.metadata.create_all(engine)
    pass
